Customizing Models with Ollama
Initial paragraphs goes here
Creating Custom Models via CLI
Copying A Model
N.B. You need to be using a bash-like shell for some ollama commands. On windows this can be done via Git Bash
Step 1: Create A Model File
To copy an AI model you can use:
ollama show llama3.2:latest --modelfile > some-filename.modelfileWhere:llama3.2:latestis the model namesome-filename.modelfileis the name of the model file we're copying into (the extension should remain.modelfile)
Step 2: Customize the Model File
At the end of the file, add SYSTEM """{Prompt}"""
- Replacing
{Prompt}with your desired system prompt (e.g.You are Albert Einstein)
Step 3: Generate a Model from the Model File
To Generate a model, you need a model file (see step 1). Then you can use:
ollama create ai-name --file some-filename.modelfile
More About the ".modelfile"
A most basic Model file
FROM llama2
PARAMETER temperature 1
PARAMETER num_ctx 4096
SYSTEM You are Mario from super mario bros, acting as an assistant.
Parameters
- Temperature: Higher is more creative, lower is more coherent.[1] Most models support a temperature range from 0 to 1, but there are exceptions.
References
- ← Previous
Fisher-Yates Shuffle - Next →
Antipattern: The Blob